<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Set-集合</title>
</head>
<body>
    <script>
        // 声明一个set
        let  s = new Set();
        let s2 = new Set(['大事','小事','好事','坏事','小事']); 
        
        //元素个数
        console.log(s2.size)
        //添加元素
        s2.add('喜事');
        console.log(s2)
        //查询是否包含
        console.log(s2.has('错事'));
        s2.delete('小事');
        console.log(s2)

        //清空集合
        //s2.clear();
        
       	//遍历set
        for(let s of s2){
            console.log(s);
        }
    </script>
</body>
</html>